import request from '@/utils/request'

// 部件表

/**
 * 获取列表
 *
 * @export
 * @param {*} data { keyword, componenTypeId, fixedAssets }
 * @returns
 */
export function fetchComponentFindPage(data) {
  return request({
    url: '/pc/base/component/findPage',
    method: 'post',
    data
  })
}

/**
 * 获取详情
 *
 * @export
 * @param {*} params { id }
 * @returns
 */
export function fetchComponentGet(params) {
  return request({
    url: '/pc/base/component/get',
    method: 'get',
    params
  })
}

/**
 * 添加
 *
 * @export
 * @param {*} data { name, headerAccountIdList, componentType, markType, parentId, area, coordinateSet, redius, address, deviceIdStr
                     orginType, price, componentTypeId, ownership, status, componentDataList  }
 * @returns
 */
export function fetchComponentAdd(data) {
  return request({
    url: '/pc/base/component/add',
    method: 'post',
    data
  })
}

/**
 * 更新
 *
 * @export
 * @param {*} data { name, headerAccountIdList, componentType, markType, parentId, area, coordinateSet, redius, address, deviceIdStr
                     orginType, price, componentTypeId, ownership, status, componentDataList  }
 * @returns
 */
export function fetchComponentUpdate(data) {
  return request({
    url: '/pc/base/component/update',
    method: 'post',
    data
  })
}

/**
 * 删除
 *
 * @export
 * @param {*} data { id }
 * @returns
 */
export function fetchComponentDelete(params) {
  return request({
    url: '/pc/base/component/delete',
    method: 'post',
    params
  })
}

/**
 * 更新状态
 *
 * @export
 * @param {*} params { status, id }
 * @returns
 */
export function fetchComponentUpdateStatus(params) {
  return request({
    url: '/pc/base/component/updateStatus',
    method: 'post',
    params
  })
}
